package cn.util;

import java.sql.Timestamp;
import java.util.Calendar;

public class Commons {
	private Commons() {
	}

	public static Integer converteDateToAge(Timestamp date) {
		if (date == null) {
			return 0;
		}
		// 当前系统时间
		Calendar cl = Calendar.getInstance();
		int year0 = cl.get(Calendar.YEAR);
		// 指定的日期时间
		cl.setTime(date);
		int year1 = cl.get(Calendar.YEAR);
		return year0 - year1 == 0 ? 1 : year0 - year1;
	}

}
